package com.xzp.blog.entity.vo;


import com.xzp.blog.entity.Article;
import org.apache.commons.lang3.time.DateFormatUtils;

/**
 * 博客列表视图,该对象注意区别文章对象
 */

public class PostView {

    private Integer id;
    private String title;  //标题
    private String description;  //描述
    private String dateTime;  //日期时间
    private String htmlMaterial;  //html内容  这里用来显示,所以获得的是html内容


    public PostView(Article article) {
        id = article.getId();
        title = article.getTitle();
        description = article.getIntroduction();
        dateTime = DateFormatUtils.format(article.getGmtCreate(),"yyyy-MM-dd HH:mm");
        htmlMaterial = article.getHtmlMaterial();
    }

    public PostView(Integer id, String title, String description, String dateTime, String htmlMaterial) {
        this.id = id;
        this.title = title;
        this.description = description;
        this.dateTime = dateTime;
        this.htmlMaterial = htmlMaterial;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getDateTime() {
        return dateTime;
    }

    public void setDateTime(String dateTime) {
        this.dateTime = dateTime;
    }

    public String getHtmlMaterial() {
        return htmlMaterial;
    }

    public void setHtmlMaterial(String htmlMaterial) {
        this.htmlMaterial = htmlMaterial;
    }
}
